<template>
	<view class="top">
		<i class="iconfont icon-geren2"></i>
		<text>{{formData.Name}}</text>
		<i class="iconfont icon-a-Frame133"></i>
		<text>{{formData.CardNo}}</text>
		<i v-if="formData.Sex=='男'" class="iconfont icon-sex_man"></i>
		<i v-else class="iconfont icon-sex_woman"></i>
		<text>{{formData.Sex}}</text>
	</view>
	<view class="content">
		<uni-forms :modelValue="formData" label-width='80px' label-align="right">
			<uni-forms-item label="随访日期" required name="name" class="uni-mt-5">
				<view class="dataView">
					<text class="tWidth">
						<!-- <uni-datetime-picker @maskClick="maskClick" type="date" return-type="data" v-model="formData.suifangRiQi"/> -->
						<uni-datetime-picker type="date" return-type="data" :clear-icon="false"
							v-model="formData.SuifangRiqi" />
					</text>
					<text><button class="greenBold uni-ml-4" @click="getLatelyFun()">载入最近体检数据</button></text>
				</view>
			</uni-forms-item>
			<uni-forms-item label="姓名">
				<uni-easyinput v-model="formData.Name" style="width: 45%;" :disabled="true" :clearable="false" />
			</uni-forms-item>
			<uni-forms-item label="随访方式">
				<uni-data-checkbox v-model="formData.SuifangFangshi" :localdata="SuifangFangshi" />
			</uni-forms-item>
			<uni-forms-item label="症状">
				<uni-data-checkbox v-model="formData.Zhengzhuang" multiple :localdata="zhengzhuang" />
			</uni-forms-item>
			<uni-forms-item label="其他症状">
				<uni-easyinput v-model="formData.Zhengzhuangqita" placeholder="无" />
			</uni-forms-item>
			<view class="hrView">
				<text>体征</text>
				<hr />
			</view>
			<view class="blood uni-mt-10">
				<uni-forms-item label="血压" required label-width="50px">
					<uni-easyinput v-model="formData.TizhengXueyaSsy" :clearable="false" class="uni-mr-3"
						placeholder="收缩压" />
					<uni-easyinput v-model="formData.TizhengXueyaSzy" :clearable="false" placeholder="舒张压" />
				</uni-forms-item>
				<uni-forms-item label="心率" class="uni-ml-5" label-width="40px">
					<uni-easyinput :clearable="false" v-model="formData.TizhengXinlv" />
					<button @click="surveyXY()" class="uni-ml-5">测量血压</button>
				</uni-forms-item>
			</view>
			<view class="blood">
				<uni-forms-item label="身高" label-width="50px">
					<uni-easyinput @bule="numberBMI()" v-model="formData.TizhengShengao" class="uni-mr-3"
						:clearable="false" placeholder="cm" />
				</uni-forms-item>
				<uni-forms-item label="体重" class="uni-ml-5" :clearable="false" label-width="50px">
					<uni-easyinput @bule="numberBMI()" v-model="formData.TizhengTizhong1" :clearable="false"
						placeholder="kg" />
					<button class="uni-ml-5">测量体重</button>
				</uni-forms-item>
			</view>
			<view class="blood">
				<uni-forms-item label="BMI" label-width="50px">
					<uni-easyinput v-model="formData.TizhengBmi1" :clearable="false" />
				</uni-forms-item>
			</view>
			<uni-forms-item label="其他症状">
				<uni-easyinput v-model="formData.TizhengQita" placeholder="无" />
			</uni-forms-item>
			<view class="hrView">
				<text>生活方式指导</text>
				<hr />
			</view>
			<view class="blood uni-mt-10">
				<uni-forms-item label="日吸烟量" label-width="170rpx">
					<uni-easyinput v-model="formData.ShenghuoXiyanRixiyanling1" :clearable="false" placeholder="0" />
				</uni-forms-item>
				<uni-forms-item label="日饮酒量" label-width="170rpx">
					<uni-easyinput v-model="formData.ShenghuoYinjiuRiyinjiuliang1" :clearable="false" placeholder="0" />
				</uni-forms-item>
			</view>
			<view class="blood">

			</view>
			<view class="blood">
				<uni-forms-item label="运动次数/周" :label-width="labelWidth210">
					<uni-easyinput v-model="formData.ShenghuoYundongMuqinpinlv" :clearable="false" placeholder="0" />
				</uni-forms-item>
				<uni-forms-item label="运动分钟/次" :label-width="labelWidth210">
					<uni-easyinput v-model="formData.ShenghuoYundongMuqinshichang" :clearable="false" placeholder="0" />
				</uni-forms-item>
			</view>
			<view class="blood">
				<uni-forms-item label="目标次数/周" :label-width="labelWidth210">
					<uni-easyinput v-model="formData.ShenghuoYundongPinlv1" :clearable="false" placeholder="0" />
				</uni-forms-item>
				<uni-forms-item label="目标分钟/次" :label-width="labelWidth210">
					<uni-easyinput v-model="formData.ShenghuoYundongShichang1" :clearable="false" placeholder="0" />
				</uni-forms-item>
			</view>
			<uni-forms-item label="摄盐情况" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.ShenghuoSheyanMuqian" :localdata="SheYan_MuQian" />
			</uni-forms-item>
			<uni-forms-item label="目标摄盐情况" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.ShenghuoSheyanMubiao" :localdata="SheYan_MuQian" />
			</uni-forms-item>
			<uni-forms-item label="心里调整" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.ShenghuoXinlitiaozheng" :localdata="XinLiTiaoZheng" />
			</uni-forms-item>
			<uni-forms-item label="辅助检查名称" :label-width="labelWidth210">
				<uni-easyinput v-model="formData.FuzhujianchaQitajianchaName" :clearable="false" placeholder="无" />
			</uni-forms-item>
			<uni-forms-item label="辅助检查结果" :label-width="labelWidth210">
				<uni-easyinput v-model="formData.FuzhujianchaQitajianchaJieguo" :clearable="false" placeholder="无" />
			</uni-forms-item>
			<view class="hrView">
				<text>目前用药情况</text>
				<hr />
			</view>
			<view class="">
				<uni-forms-item label="药品名称1" style="height: 40rpx" class="uni-mt-10">
					<view class="newBox">
						<uni-easyinput v-model="formData.YaowuMingcheng" :clearable="false" />
						<button @click="goDrugs(1)">选择药品</button>
					</view>
				</uni-forms-item>
				<uni-forms-item label="每日(频次)" style="height: 40rpx" class="blueColor">
					<view class="Double">
						<view>
							<uni-easyinput v-model="formData.YaowuPinci" placeholder="次" :clearable="false" />
						</view>
						<view>
							<uni-forms-item label="每次(用量)" label-width="160rpx">
								<uni-easyinput v-model="formData.YaowuYongliang" :clearable="false" />
							</uni-forms-item>
						</view>
					</view>
				</uni-forms-item>
				<uni-forms-item label="备注" style="height: 40rpx" class="blueColor" label-width="160rpx">
					<uni-easyinput v-model="formData.YaowuBeizhu" :clearable="false" />
				</uni-forms-item>
			</view>
			<view>
				<uni-forms-item label="药品名称2" style="height: 40rpx;margin-top: 70rpx;">
					<view class="newBox">
						<uni-easyinput v-model="formData.YaowuMingcheng1" :clearable="false" />
						<button @click="goDrugs(2)">选择药品</button>
					</view>
				</uni-forms-item>
				<uni-forms-item label="每日(频次)" style="height: 40rpx" class="blueColor">
					<view class="Double">
						<view>
							<uni-easyinput v-model="formData.YaowuPinci1" placeholder="次" :clearable="false" />
						</view>
						<view>
							<uni-forms-item label="每次(用量)" label-width="160rpx">
								<uni-easyinput v-model="formData.YaowuYongliang1" :clearable="false" />
							</uni-forms-item>
						</view>
					</view>
				</uni-forms-item>
				<uni-forms-item label="备注" style="height: 40rpx" class="blueColor" label-width="160rpx">
					<uni-easyinput v-model="formData.YaowuBeizhu1" :clearable="false" />
				</uni-forms-item>
			</view>
			<view class="">
				<uni-forms-item label="药品名称3" style="height: 40rpx;margin-top: 70rpx;" class="uni-mt-10">
					<view class="newBox">
						<uni-easyinput v-model="formData.YaowuMingcheng2" :clearable="false" />
						<button @click="goDrugs(3)">选择药品</button>
					</view>
				</uni-forms-item>
				<uni-forms-item label="每日(频次)" style="height: 40rpx" class="blueColor">
					<view class="Double">
						<view>
							<uni-easyinput v-model="formData.YaowuPinci2" placeholder="次" :clearable="false" />
						</view>
						<view>
							<uni-forms-item label="每次(用量)" label-width="160rpx">
								<uni-easyinput v-model="formData.YaowuYongliang2" :clearable="false" />
							</uni-forms-item>
						</view>
					</view>
				</uni-forms-item>
				<uni-forms-item label="备注" style="height: 40rpx" class="blueColor" label-width="160rpx">
					<uni-easyinput v-model="formData.YaowuBeizhu2" :clearable="false" />
				</uni-forms-item>
			</view>


			<uni-forms-item label="服药依从性" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.YaowuFuyaoyicongxing" :localdata="FuYaoYiCongXing" />
			</uni-forms-item>
			<uni-forms-item label="遵医行为" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.ShenghuoZunyixingwei" :localdata="XinLiTiaoZheng" />
			</uni-forms-item>
			<uni-forms-item class="badness" label="药物不良反应" :label-width="labelWidth210">
				<view style="display: flex;">
					<view class="">
						<uni-data-checkbox v-model="formData.YaowuYaowubuliangfanying"
							:localdata="YaoWuBuLiangFanYing" />
					</view>
					<view class="">
						<uni-easyinput placeholder="不良反应内容" :clearable="false" />
					</view>
				</view>
			</uni-forms-item>
			<uni-forms-item label="此次随访分类" :label-width="labelWidth210">
				<uni-data-checkbox v-model="formData.SuiFangFenLei" :localdata="SuiFangFenLei" />
			</uni-forms-item>
			<view class="hrView">
				<text>用药调整意见
					<!-- <text style="left: 190rpx;"><button class="green">同步目前用药</button></text>
						<text style="left: 410rpx;"><button class="greenBold">清空目前用药</button></text> -->
				</text>
				<hr />
			</view>
			<view class="">
				<uni-forms-item label="药品名称" class="uni-mt-10" style="height: 40rpx">
					<view class="newBox">
						<uni-easyinput v-model="formData.YaowuMingcheng3" :clearable="false" />
						<button @click="goDrugs(4)">选择药品</button>
					</view>
				</uni-forms-item>
				<uni-forms-item label="每日(频次)" style="height: 40rpx" class="blueColor">
					<view class="Double">
						<view>
							<uni-easyinput v-model="formData.YaowuPinci3" placeholder="次" :clearable="false" />
						</view>
						<view>
							<uni-forms-item label="每次(用量)" label-width="160rpx">
								<uni-easyinput v-model="formData.YaowuYongliang3" :clearable="false" />
							</uni-forms-item>
						</view>
					</view>
				</uni-forms-item>
				<uni-forms-item label="备注" style="height: 40rpx" class="blueColor" label-width="160rpx">
					<uni-easyinput v-model="formData.YaowuBeizhu3" :clearable="false" />
				</uni-forms-item>
			</view>
			<view class="hrView uni-mt-10 uni-mb-5">
				<text>转诊</text>
				<hr />
			</view>
			<uni-forms-item label="转诊原因" :label-width="labelWidth210">
				<uni-easyinput v-model="formData.ZhuanzhenYuanyin" :clearable="false" />
			</uni-forms-item>
			<uni-forms-item label="机构及科别" :label-width="labelWidth210">
				<uni-easyinput v-model="formData.ZhuanzhenJigou" :clearable="false" />
			</uni-forms-item>
			<view class="hrView">
				<hr />
			</view>
			<uni-forms-item label="下次随访日期" name="name" :label-width="labelWidth210" class="uni-mt-5">
				<uni-datetime-picker type="date" return-type="data" :clear-icon="false"
					v-model="formData.Xiacisuifangriqi" />
			</uni-forms-item>
			<uni-forms-item label="备注" name="name" :label-width="labelWidth210" class="uni-mt-5">
				<uni-easyinput placeholder="无" />
			</uni-forms-item>
			<uni-forms-item label="医生签名" style="height: 50px;" :label-width="labelWidth210">
				<image class="signature" @click="goSignature(1)" :src="formData.YishengQianMing" mode="" />
			</uni-forms-item>
			<uni-forms-item label="录入人" :label-width="labelWidth210">
				<uni-easyinput v-model="formData.Lururen" />
			</uni-forms-item>
			<uni-forms-item label="居民签名" style="height: 50px;" :label-width="labelWidth210">
				<image class="signature" @click="goSignature(2)" :src="formData.jumingQianMing" mode="" />
			</uni-forms-item>
			<uni-forms-item label="指导建议" :label-width="labelWidth210">
				<uni-easyinput type="textarea" v-model="formData.Jiankangzhidao" />
			</uni-forms-item>
		</uni-forms>
		<button @click="submitForm" class="submitBut">保存</button>
		<view class="uni-mt-10" style="height: 10rpx;"></view>
	</view>
</template>

<script>
	import {
		addSuifang,
		getDetails,
		getSuifang,
		addSuifangForm,
		getLately
	} from '@/api/index.js'
	import usedList from '../../static/bledevices.json'
	export default {
		data() {
			return {
				SuifangFangshi: [{
					text: '门诊',
					value: '1'
				}, {
					text: '家庭',
					value: '2'
				}, {
					text: '电话',
					value: '3'
				}],
				zhengzhuang: [{
					text: '无症状',
					value: 1
				}, {
					text: '头痛头晕',
					value: 2
				}, {
					text: '恶心呕吐',
					value: 3
				}, {
					text: '眼花耳鸣',
					value: 4
				}, {
					text: '呼吸困难',
					value: 5
				}, {
					text: '心悸胸闷',
					value: 6
				}, {
					text: '鼻衄出血不止',
					value: 7
				}, {
					text: '四肢发麻',
					value: 8
				}, {
					text: '下肢水肿',
					value: 9
				}],
				SheYan_MuQian: [{
					text: '轻',
					value: 1
				}, {
					text: '中',
					value: 2
				}, {
					text: '重',
					value: 3
				}],
				XinLiTiaoZheng: [{
					text: '良好',
					value: '1'
				}, {
					text: '一般',
					value: '2'
				}, {
					text: '差',
					value: '3'
				}],
				FuYaoYiCongXing: [{
					text: '规律',
					value: '1'
				}, {
					text: '间断',
					value: '2'
				}, {
					text: '不服药',
					value: '3'
				}],
				YaoWuBuLiangFanYing: [{
					text: '有',
					value: '1'
				}, {
					text: '无',
					value: '2'
				}],
				SuiFangFenLei: [{
					text: '控制满意',
					value: '1'
				}, {
					text: '控制不满意',
					value: '2'
				}, {
					text: '不良反应',
					value: '3'
				}, {
					text: '并发症',
					value: '4'
				}],
				labelWidth210: '120px',
				formData: {
					TizhengBmi1: this.TizhengBmiCom
				},
				oldFormData: {},
				ID: '',
				AppId: '',
				yaopinNum: '',
				yiimgUrl: '',
				juimgUrl: '',
				imgNum: '', // 判断医生前面还是居民签名
				msg: '',
				timer: '',
				reconnectTimer: '',
				BrightScreen: true,
				GXYMap:{
					'TizhengXinlv':'chati_xinzang_xinluv',
					'TizhengShengao':'yiban_shengao',
					'TizhengTizhong1':'yiban_tizhong',
					'TizhengBmi1':'yiban_tizhi',
					'YaowuMingcheng':'yaowu_mingcheng',
					'YaowuMingcheng1':'yaowu_mingcheng1',
					'YaowuMingcheng2':'yaowu_mingcheng2',
					'YaowuPinci': 'yaowu_pinci',
					'YaowuPinci1': 'yaowu_pinci1',
					'YaowuPinci2': 'yaowu_pinci2',
					'YaowuYongliang':'yaiwu_yongliang',
					'YaowuYongliang1':'yaiwu_yongliang1',
					'YaowuYongliang2':'yaiwu_yongliang2',
					'YaowuFuyaoyicongxing':'yaowu_yicongxing',
					'ShenghuoYinjiuRiyinjiuliang1':'shenghuo_yinjiu_rijunjiuliang',
					'ShenghuoXiyanRixiyanling1':'shenghuo_xiyan_zhuangkuang'
				}
			}
		},
		onLoad(option) {
			this.msg = option.msg
			this.ID = option.Id
			this.AppId = option.appId
			if (option.Id) { // 存在编辑
				getSuifang(option.Id).then(res => { // 随访记录详情
					this.formData = JSON.parse(JSON.stringify({
						...res
					}))
					this.oldFormData = JSON.parse(JSON.stringify({
						...res
					}))
					this.formData.Zhengzhuang = res.Zhengzhuang?.split(',').map(Number)
					this.formData.TizhengBmi1 = this.TizhengBmiCom
				})
			} else { // 不存在新增
				addSuifangForm(option.appId).then(res => {
					console.log('res',res)
					this.formData = JSON.parse(JSON.stringify({
						...res[0]
					}))
					this.oldFormData = JSON.parse(JSON.stringify({
						...res[0]
					}))
					this.formData.Zhengzhuang = res[0].Zhengzhuang?.split(',').map(Number)
					this.formData.TizhengBmi1 = this.TizhengBmiCom
					this.formData.AppId = option.appId
				})

			}
		},
		onShow() {
			this.XYDeviceId = uni.getStorageSync('XY').deviceId
			this.device = uni.getStorageSync('XY')
			this.BrightScreen = true
			this.initBlueTooth()
		
		},
		onHide() {
			clearTimeout(this.reconnectTimer)
			clearTimeout(this.timer)
			this.BrightScreen = false
		},
		onUnload() {
			clearTimeout(this.reconnectTimer)
			clearTimeout(this.timer)
			this.BrightScreen = false
		},
		methods: {
			initBlueTooth() {
				let that = this
				uni.openBluetoothAdapter({
					success(res) {
						console.log('初始化蓝牙成功');
						that.surveyXY()
					},
					fail(err) {
						uni.showToast({
							icon: "none",
							title: "查看手机蓝牙是否打开"
						});
						console.log('初始化蓝牙失败', err)
					}
				})
				plus.bluetooth.onBLEConnectionStateChange(function(e) {
					console.log(e);
					if (e.connected == false) {
						plus.bluetooth.closeBluetoothAdapter({
							success: function(e) {
								console.log('close success: ' + JSON.stringify(e));
							},
							fail: function(e) {
								console.log('close failed: ' + JSON.stringify(e));
							}
						});
						that.connectBluetooth()
					}
				});
			},
			// 启用低功耗蓝牙设备特征值变化时的notify功能，订阅特征值
			startNotify(serviceId, charUuid) {
				let that = this
				plus.bluetooth.notifyBLECharacteristicValueChange({
					deviceId: that.XYDeviceId,
					serviceId: serviceId,
					characteristicId: charUuid,
					success: (res) => {
						console.log('开始监听设备')
						plus.bluetooth
							.onBLECharacteristicValueChange(
								function(e) {
									const uint8View = new Uint8Array(e.value);
									that.formData.TizhengXueyaSsy = uint8View[1]
									that.formData.TizhengXueyaSzy = uint8View[3]
									that.formData.TizhengXinlv = uint8View[14]
								});
					},
					fail: (e) => {
						console.log(e);
					}
				});
			},
			
			// 确定设备
			makeSureDevice() {
				let that = this
				for (let i = 0; i < usedList.length; i++) {
					if (that.device.name.indexOf(usedList[i].BltName) != -1) {
						console.log(usedList[i].BltName);
						for (let j = 0; j < that.device.advertisServiceUUIDs.length; j++) {
							if (that.device.advertisServiceUUIDs[j].toUpperCase() == usedList[i]
								.ServerUuid.toUpperCase()) {
								that.timer = setTimeout(() => {
									that.startNotify(usedList[i].ServerUuid, usedList[i]
										.CharacteristicUuid)
								}, 2000)
							}
						}
					}
				}
			},
			// 连接蓝牙
			connectBluetooth() {
				let that = this
				console.log(that.XYDeviceId);
				uni.createBLEConnection({
					deviceId: that.XYDeviceId,
					success: (res) => {
						console.log('success')
						that.makeSureDevice()
					},
					fail: (e) => {
						console.log(e);
						if (e.code == '-1') {
							that.makeSureDevice()
						} else {
							if (that.BrightScreen) {
								that.reconnectTimer = setTimeout(() => {
									that.initBlueTooth()
								}, 5000)
							}
			
						}
			
					}
				})
			},
			// 测量血压
			async surveyXY(e) {
				let that = this
				that.connectBluetooth()
			},
			getLatelyFun() {
				getLately(this.AppId).then(res => {
					if(res.length > 0){
						this.formData.TizhengXinlv = res[0][this.GXYMap.TizhengXinlv]
						this.formData.TizhengShengao = res[0][this.GXYMap.TizhengShengao]
						this.formData.TizhengTizhong1 = res[0][this.GXYMap.TizhengTizhong1]
						this.formData.TizhengBmi1 = res[0][this.GXYMap.TizhengBmi1]
						this.formData.YaowuMingcheng = res[0][this.GXYMap.YaowuMingcheng]
						this.formData.YaowuMingcheng1 = res[0][this.GXYMap.YaowuMingcheng1]
						this.formData.YaowuMingcheng2 = res[0][this.GXYMap.YaowuMingcheng2]
						this.formData.YaowuPinci = res[0][this.GXYMap.YaowuPinci]
						this.formData.YaowuPinci1 = res[0][this.GXYMap.YaowuPinci1]
						this.formData.YaowuPinci2 = res[0][this.GXYMap.YaowuPinci2]
						this.formData.YaowuYongliang = res[0][this.GXYMap.YaowuYongliang]
						this.formData.YaowuYongliang1 = res[0][this.GXYMap.YaowuYongliang1]
						this.formData.YaowuYongliang2 = res[0][this.GXYMap.YaowuYongliang2]
						this.formData.YaowuFuyaoyicongxing = res[0][this.GXYMap.YaowuFuyaoyicongxing]
						this.formData.ShenghuoYinjiuRiyinjiuliang1 = res[0][this.GXYMap.ShenghuoYinjiuRiyinjiuliang1]
						this.formData.ShenghuoXiyanRixiyanling1 = res[0][this.GXYMap.ShenghuoXiyanRixiyanling1]
						uni.showToast({
							icon: 'none',
							title: '载入成功'
						})
					}else{
						uni.showToast({
							icon: 'none',
							title: '无数据'
						})
					}
				})
			},
			submitForm() {
				this.formData.Zhengzhuang ? this.formData.Zhengzhuang = this.formData.Zhengzhuang.toString() : ''
				let form = this.findDifferentValues(this.oldFormData, this.formData)
				// console.log(form)
				this.formData.Xiacisuifangriqi = this.formData.Xiacisuifangriqi ? this.formData.Xiacisuifangriqi :this.getTime(this.formData.SuifangRiqi)
				addSuifang(this.formData).then(res => {
					if (res == "1" || res.Id != '0') {
						uni.showToast({
							icon: 'none',
							title: '保存成功'
						})
						setTimeout(() => {
							return uni.navigateBack({
								url: '/pages/start/start'
							})
						}, 2000)
					}
				})
			},
			getTime(inputDateStr){
				// 将字符串转换为日期对象
				var inputDate = new Date(inputDateStr);
				// 将日期向后延迟三个月
				inputDate.setMonth(inputDate.getMonth() + 3);
				// 将延迟后的日期转换为字符串
				var delayedDateStr = inputDate.toISOString();
				return delayedDateStr
			},
	
			findDifferentValues(obj, obj2) {
				var str = {}
				for (let key in obj) {
					for (let keys in obj2) {
						if (obj[key] != obj2[key]) {
							str[key] = obj2[key]
						}
					}
				}
				return str;
			},

			goDrugs(val) {
				this.yaopinNum = val // 存储判断返回回来的药品是第几个药品
				uni.navigateTo({
					url: `/pages/Drugs/Drugs?msg=${this.msg}`
				})
			},
			maskClick(e) {
				console.log('maskClick事件:', e);
			},
			numberBMI() { // 失去焦点计算体脂

			},
			prevDateFun(object) { // 接收返回回来的药品
				if (this.yaopinNum == '1') {
					this.formData.YaowuMingcheng = object.name
					this.formData.YaowuPinci = object.pinci
					this.formData.YaowuYongliang = object.yongliang
					this.formData.YaowuBeizhu = object.beizhu
				} else if (this.yaopinNum == '2') {
					this.formData.YaowuMingcheng1 = object.name
					this.formData.YaowuPinci1 = object.pinci
					this.formData.YaowuYongliang1 = object.yongliang
					this.formData.YaowuBeizhu1 = object.beizhu
				} else if (this.yaopinNum == '3') {
					this.formData.YaowuMingcheng2 = object.name
					this.formData.YaowuPinci2 = object.pinci
					this.formData.YaowuYongliang2 = object.yongliang
					this.formData.YaowuBeizhu2 = object.beizhu
				} else if (this.yaopinNum == '4') {
					this.formData.YaowuMingcheng3 = object.name
					this.formData.YaowuPinci3 = object.pinci
					this.formData.YaowuYongliang3 = object.yongliang
					this.formData.YaowuBeizhu3 = object.beizhu
				}

			},
			goSignature(val) {
				this.imgNum = val
				uni.navigateTo({
					url: "/pages/signature/signature"
				})
			},
			signatureImg(object) {
				if (this.imgNum == '1') { // 医生签字
					this.formData.YishengQianMing = object
				} else if (this.imgNum == '2') { // 居民签字
					this.formData.jumingQianMing = object
				}
				// console.log('img',object)

			}
		},
		computed: {
			TizhengBmiCom() {
				return this.formData.TizhengShengao && this.formData.TizhengTizhong1 ?
					(this.formData.TizhengTizhong1 / ((this.formData.TizhengShengao / 100) * (this.formData
						.TizhengShengao / 100))).toFixed(2) : ''
			}
		},
		watch: {
			TizhengBmiCom(newVal, oldVal) {
				this.formData.TizhengBmi1 = newVal
			}
		}
	}
</script>

<style lang="scss">
	.uni-easyinput {
		font-size: 16px;
		/* 设置输入框的字体大小 */
		transform: none;
		/* 取消输入时的放大效果 */
	}

	.content {
		width: 100wh;
		padding: 0 15rpx;
		box-sizing: border-box;
	}

	:deep(.uni-data-checklist) {
		top: 12rpx !important;
	}

	.top {
		display: flex;
		font-size: 22rpx;
		background-color: #C9F7CA;
		padding: 0 15rpx;
		height: 60rpx;
		line-height: 60rpx;

		text {
			margin-right: 10rpx;
		}
	}

	.dataView {
		display: flex;
		align-items: center;

		button {
			font-size: 26rpx;
			border-radius: 100rpx;
		}

		.tWidth {
			width: 45%;
		}
	}

	.Double {
		display: flex;

		:deep(.uni-select) {
			margin-right: 75rpx;
		}

		.uni-easyinput {
			width: 90%;
		}
	}

	.blood {
		display: flex;

		:deep(.uni-forms-item__content) {
			display: flex !important;
			height: 20px;

			.uni-easyinput__content-input {
				width: 40px !important;
			}

			button {
				font-size: 20rpx;
				border-radius: 100rpx;
				background-color: #009316;
				color: white;
				height: 35px;
				line-height: 35px;
			}
		}
	}

	.hrView {
		position: relative;
		height: 40rpx;

		text {
			padding: 0 15rpx;
			position: absolute;
			display: inline-block;
			background-color: #F5F5F5;
			z-index: 1;
			margin-left: 20rpx;
		}

		hr {
			width: 100%;
			position: absolute;
			top: 20rpx;
			background-color: #dfdfdf;
			border: 1px solid #dfdfdf;
			border-bottom: none;
		}

		button {
			font-size: 22rpx;
			width: 200rpx
		}
	}

	// .blueColor >:deep(.uni-forms-item__label){
	// 	color:#4197C6 !important;
	// }
	.badness {
		.uni-easyinput {
			margin-left: 15rpx;
			width: 110px;
		}
	}

	.green {
		background-color: #009316;
		color: white;
	}

	.greenBold {
		background-color: #008989;
		color: white;
	}

	.signature {
		border: 1px solid #dfdfdf;
		height: 200rpx;
		width: 100rpx;
		transform-origin: right;
		transform: rotate(90deg);
	}

	textarea {
		border: 1px solid #dfdfdf;
		width: 100%;
		min-height: 300rpx;
	}

	.submitBut {
		font-size: 20rpx;
		border-radius: 100rpx;
		background-color: #009316;
		color: white;
		width: 20%;
	}

	.newBox {
		display: flex;

		button {
			margin-left: 10rpx;
			font-size: 16rpx;
			height: 70rpx;
			line-height: 70rpx;
			background-color: #009316;
			color: white;
		}
	}
</style>